<template>
  <div>
    <el-button type="primary" @click="CastScreen">投屏</el-button>
    <el-button type="primary" @click="NumberScreen">数值</el-button>
    <screen v-if="clickFun==='p'" :pictures="pictures" :pic-prefix="picPrefix" @refresh="refreshScreen" />
  </div>
</template>

<script>
import { GetPicture } from '@/api/win'
import Screen from './components/Screen'

export default {
  name: 'BlackIndex',
  components: {
    Screen
  },
  data() {
    return {
      pictures: [],
      picPrefix: '',
      clickFun: 'p'
    }
  },
  mounted() {
    this.CastScreen()
  },
  methods: {
    CastScreen() {
      this.clickFun = 'p'
      GetPicture().then(res => {
        this.pictures = res.data
        this.picPrefix = res.prefix
      })
    },
    NumberScreen() {
      this.clickFun = 'n'
    },
    refreshScreen() {
      this.CastScreen()
    }
  }
}
</script>

<style scoped>

</style>
